﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Xaml;
using System.Resources;
using ASPItalia.ModelVirtualCasting.Silverlight.BackOffice.Resources;
using System.Windows.Markup;

namespace ASPItalia.ModelVirtualCasting.Silverlight.BackOffice.MarkupExtensions
{
    public class LocalizationExtension : IMarkupExtension<object>
    {
        public string Key { get; set; }

        public object ProvideValue(IServiceProvider serviceProvider)
        {
            IProvideValueTarget targetProvider = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;
            if (targetProvider != null)
            {
                var o = targetProvider.TargetObject;
                var p = targetProvider.TargetProperty;
            }

            IXamlTypeResolver xamlResolver = serviceProvider.GetService(typeof(IXamlTypeResolver)) as IXamlTypeResolver;
            IRootObjectProvider rootObject = serviceProvider.GetService(typeof(IRootObjectProvider)) as IRootObjectProvider;

            return Resource.ResourceManager.GetString(Key);
        }
    }
}
